package com.example.dao;

import com.example.entity.Userinfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserinfoDao
{
    @Select("select * from userinfo where name = #{name}")
    Userinfo userinfoSelect(String name);

    @Select("select * from userinfo")
    List<Userinfo> select();

    @Insert("insert into userinfo values(#{name},#{password},#{if_online},#{last_time})")
    void userinfoInsert(Userinfo userinfo);

    @Update("update userinfo set last_time = #{last_time} where name = #{name}")
    void dateUpdate(String last_time,String name);//更新上次在线时间

    @Update("update userinfo set if_online = #{if_online} where name = #{name}")
    void onlineUpdate(Integer if_online,String name);//更新在线状态

}
